<?php if(Yii::app()->user->hasFlash('coffee_update')){ ?>

<div class="flash-success">
	<?php echo Yii::app()->user->getFlash('coffee_update'); ?>
</div>
<?php } ?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	//'action'=>array('coffeeShop/update'),
	'id'=>'coffeeshop-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>64)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'street'); ?>
		<?php echo $form->textField($model,'street',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'street'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'suburb'); ?>
		<?php echo $form->textField($model,'suburb',array('size'=>32,'maxlength'=>32)); ?>
		<?php echo $form->error($model,'suburb'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'city'); ?>
		<?php echo $form->textField($model,'city',array('size'=>32,'maxlength'=>32)); ?>
		<?php echo $form->error($model,'city'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'state'); ?>
		<?php echo $form->textField($model,'state',array('size'=>32,'maxlength'=>32)); ?>
		<?php echo $form->error($model,'state'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'postcode'); ?>
		<?php echo $form->textField($model,'postcode',array('size'=>32,'maxlength'=>32)); ?>
		<?php echo $form->error($model,'postcode'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'country'); ?>
		<?php echo $form->textField($model,'country',array('size'=>32,'maxlength'=>32)); ?>
		<?php echo $form->error($model,'country'); ?>
	</div>
	
		<div class="row">
		<?php echo $form->labelEx($model,'latitude'); ?>
		<?php echo $form->textField($model,'latitude'); ?>
		<?php echo $form->error($model,'latitude'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'longitude'); ?>
		<?php echo $form->textField($model,'longitude'); ?>
		<?php echo $form->error($model,'longitude'); ?>
	</div>
	
		<div class="row buttons">
		<?php echo CHtml::submitButton('Get Geo Info',array('name'=>'geo')); ?> 	
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'beanRating'); ?>
		<?php echo $form->textField($model,'beanRating',array('size'=>3,'maxlength'=>3)); ?>
		<?php echo $form->error($model,'beanRating'); ?>
	</div>



	<div class="row">
		<?php echo $form->labelEx($model,'review'); ?>
		<?php echo $form->textArea($model,'review',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'review'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'reviewTop100'); ?>
		<?php echo $form->textArea($model,'reviewTop100',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'reviewTop100'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'premiumAccess'); ?>
		<?php echo $form->checkBox($model,'premiumAccess'); ?>
		If checked, the owner can always edit cafe regardless of subscription.
		<?php echo $form->error($model,'premiumAccess'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'lockReview'); ?>
		<?php echo $form->checkBox($model,'lockReview'); ?>
		If checked, the owner can NOT edit the review.
		<?php echo $form->error($model,'lockReview'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'lockPhoto'); ?>
		<?php echo $form->checkBox($model,'lockPhoto'); ?>
		If checked, the owner can NOT edit the photo.
		<?php echo $form->error($model,'lockPhoto'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'phone'); ?>
		<?php echo $form->textField($model,'phone',array('size'=>16,'maxlength'=>16)); ?>
		<?php echo $form->error($model,'phone'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'website'); ?>
		<?php echo $form->textField($model,'website',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo $form->error($model,'website'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'email'); ?>
		<?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'email'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'ownerName'); ?>
		<?php echo $form->textField($model,'ownerName',array('size'=>60,'maxlength'=>128)); ?>
		This is the owner's name text displayed on the web. To choose a user in the system that can manage this cafe, use the textbox below.
		<?php echo $form->error($model,'ownerName'); ?>
		
	</div>
<?php if($model->owner) {?>
		<div class="row"> <?php echo $form->labelEx($model,'ownerId'); ?>
		<?php echo CHtml::link($model->owner->username,array('/user/user/update','id'=>$model->ownerId),array('target'=>'_blank')); ?>
		<?php echo $form->error($model,'ownerId');?> </div>
	<?php } ?>
	<div class="row">
<?php echo CHtml::label("Choose Other Owner",'coffeeShop'); ?>
		<?php               $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
			     'name'=>'coffeeShopId2',
			     'sourceUrl'=>array('ajaxQuickSearchUser'),
			     // additional javascript options for the autocomplete plugin
			     'options'=>array(
			         'showAnim'=>'fold',
              		'minLength'=>2,
              'select'=>'js:function(event,ui){$("#CoffeeShop_ownerId").val(ui.item.id);}',
			      ),
			   'htmlOptions'=>array(
			       //'style'=>'height:20px;'
			       
			   ),
			   ));
    ?>
    <?php echo $form->hiddenField($model,'ownerId'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'baristaNames'); ?>
		<?php echo $form->textField($model,'baristaNames',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo $form->error($model,'baristaNames'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'coffeeBrand'); ?>
		<?php echo $form->textField($model,'coffeeBrand',array('size'=>32,'maxlength'=>32)); ?>
		<?php echo $form->error($model,'coffeeBrand'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'espressoMachine'); ?>
		<?php echo $form->textField($model,'espressoMachine',array('size'=>32,'maxlength'=>32)); ?>
		<?php echo $form->error($model,'espressoMachine'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'beansForSale'); ?>
		<?php echo $form->checkBox($model,'beansForSale'); ?>
		<?php echo $form->error($model,'beansForSale'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'internetAccess'); ?>
		<?php echo $form->checkBox($model,'internetAccess'); ?>
		<?php echo $form->error($model,'internetAccess'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'roastingOnSite'); ?>
		<?php echo $form->checkBox($model,'roastingOnSite'); ?>
		<?php echo $form->error($model,'roastingOnSite'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'wifi'); ?>
		<?php echo $form->checkBox($model,'wifi'); ?>
		<?php echo $form->error($model,'wifi'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'goodForBusiness'); ?>
		<?php echo $form->checkBox($model,'goodForBusiness'); ?>
		<?php echo $form->error($model,'goodForBusiness'); ?>
	</div>


	<div class="row">
		Copy day 1 to other fields if empty:
		<?php echo CHtml::checkBox("copy_day1") ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day1Start'); ?>
		<?php echo $form->textField($model,'day1Start'); ?>
		<?php echo $form->error($model,'day1Start'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day1End'); ?>
		<?php echo $form->textField($model,'day1End'); ?>
		<?php echo $form->error($model,'day1End'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day2Start'); ?>
		<?php echo $form->textField($model,'day2Start'); ?>
		<?php echo $form->error($model,'day2Start'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day2End'); ?>
		<?php echo $form->textField($model,'day2End'); ?>
		<?php echo $form->error($model,'day2End'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day3Start'); ?>
		<?php echo $form->textField($model,'day3Start'); ?>
		<?php echo $form->error($model,'day3Start'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day3End'); ?>
		<?php echo $form->textField($model,'day3End'); ?>
		<?php echo $form->error($model,'day3End'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day4Start'); ?>
		<?php echo $form->textField($model,'day4Start'); ?>
		<?php echo $form->error($model,'day4Start'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day4End'); ?>
		<?php echo $form->textField($model,'day4End'); ?>
		<?php echo $form->error($model,'day4End'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day5Start'); ?>
		<?php echo $form->textField($model,'day5Start'); ?>
		<?php echo $form->error($model,'day5Start'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day5End'); ?>
		<?php echo $form->textField($model,'day5End'); ?>
		<?php echo $form->error($model,'day5End'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day6Start'); ?>
		<?php echo $form->textField($model,'day6Start'); ?>
		<?php echo $form->error($model,'day6Start'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day6End'); ?>
		<?php echo $form->textField($model,'day6End'); ?>
		<?php echo $form->error($model,'day6End'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day7Start'); ?>
		<?php echo $form->textField($model,'day7Start'); ?>
		<?php echo $form->error($model,'day7Start'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'day7End'); ?>
		<?php echo $form->textField($model,'day7End'); ?>
		<?php echo $form->error($model,'day7End'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php echo $form->textField($model,'status'); ?>
		<?php echo $form->error($model,'status'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'volume'); ?>
		<?php echo $form->textField($model,'volume'); ?>
		<?php echo $form->error($model,'volume'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'showWeb'); ?>
		<?php echo $form->checkBox($model,'showWeb'); ?>
		<?php echo $form->error($model,'showWeb'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'showIphone'); ?>
		<?php echo $form->checkBox($model,'showIphone'); ?>
		<?php echo $form->error($model,'showIphone'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'showReview'); ?>
		<?php echo $form->checkBox($model,'showReview'); ?>
		<?php echo $form->error($model,'showReview'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'hotshot'); ?>
		<?php echo $form->checkBox($model,'hotshot'); ?>
		<?php echo $form->error($model,'hotshot'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'hotChocolate'); ?>
		<?php echo $form->checkBox($model,'hotChocolate'); ?>
		<?php echo $form->error($model,'hotChocolate'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'top100'); ?>
		<?php echo $form->checkBox($model,'top100'); ?>
		<?php echo $form->error($model,'top100'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'upgraded'); ?>
		<?php echo $form->checkBox($model,'upgraded'); ?>
		<?php echo $form->error($model,'upgraded'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->